<%@ Page language="c#" Codebehind="Attachment.aspx.cs" AutoEventWireup="false" Inherits="CommunityServer.ControlPanel.Blogs.AttachmentPage" %>

<CP:Container runat="server" id="MPContainer" ThemeMasterFile="ControlPanelModalMaster.ascx" IsModal="true">
	<CP:Content id="bcr" runat="server">
		<cp:UploadAttachment id="UploadAttachment" runat="server">
		    <SkinTemplate>
		        <div class="CommonContentArea">
	            <div class="CommonContent">
		            <div class="CommonFormArea">
            		
		            <cp:Donut runat="server" ID="Error" Visible="False">
			            <div class="CommonValidationWarning">
				            <asp:Literal Runat="server" />		
			            </div>
		            </cp:Donut>
            				
		            <table width="100%" cellpadding="0" cellspacing="0" border="0">
			            <tr>
				            <td class="CommonFormDescription" colspan="3">
					            <asp:Literal Runat="server" ID="Instructions" />
				            </td>
			            </tr>
			            <tr valign="top" runat="server" id="LocalAttachmentArea">
				            <td class="CommonFormField">
					            <asp:RadioButton ID="UploadFile" runat="server" GroupName="UploadOption" Checked="True" />
				            </td>
				            <td class="CommonFormFieldName">
					            <cp:ResourceControl ResourceName="UploadAttachment_File" runat="server" />
					            <div class="CommonFormFieldDescription">
						            <cp:ResourceControl ResourceName="UploadAttachment_File_Description" runat="server" />				
					            </div>
				            </td>
				            <td class="CommonFormField">
				                <input id="File" type="file" runat="server" />
				            </td>
			            </tr>
			            <tr valign="top" runat="server" id="RemoteAttachmentArea">
				            <td class="CommonFormField">
					            <asp:RadioButton ID="LinkToUrl" Runat="server" GroupName="UploadOption" />
				            </td>
				            <td class="CommonFormFieldName">
					            <cp:ResourceControl ResourceName="UploadAttachment_Url" runat="server" />
					            <div class="CommonFormFieldDescription">
						            <cp:ResourceControl ResourceName="UploadAttachment_Url_Description" runat="server" />
					            </div>
				            </td>
				            <td class="CommonFormField"><asp:TextBox ID="Url" Runat="server" Columns="40" /></td>
			            </tr>
			            <tr>
				            <td colspan="3" class="CommonFormActionButtons">
					            <asp:LinkButton id="Save" Runat="server" CssClass="CommonTextButton" />
				            </td>
			            </tr>
		            </table>
		            </div>
	            </div>
            </div>

            <script language="javascript">

                function enableFileUpload()
                {
	                var e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "File").ClientID %>');
	                if (e) { e.disabled = false; }
	                e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "Url").ClientID %>');
	                if (e) { e.disabled = true; }
                }

                function enableLinkToUrl()
                {
	                var e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "File").ClientID %>');
	                if (e) { e.disabled = true; }
	                e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "Url").ClientID %>');
	                if (e) { e.disabled = false; }
                }

                var e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "UploadFile").ClientID %>');
                if (e) { e.onclick = enableFileUpload; }
                if (e && e.checked)
	                enableFileUpload();

                e = document.getElementById('<%= CommunityServer.Controls.CSControlUtility.Instance().FindControl(this, "LinkToUrl").ClientID %>')
                if (e) { e.onclick = enableLinkToUrl; }
                if (e && e.checked)
	                enableLinkToUrl();

            </script>
		    </SkinTemplate>
		</cp:UploadAttachment>
	</CP:Content>
</CP:Container>
